<?php


namespace app\api\model;


use think\Model;

class HealthTopicModel extends Model
{

    // 表名
    protected $name = 'health_topic';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;
    protected $append = ['sheet_list'];

    public function getSheetListAttr($name,$data)
    {
        $kindModel = new HealthKindModel();
        $list = $kindModel->where(['topic_id'=>$data['id'],'is_show'=>1])->group('sheet')->column('id,remark,sheet');
        return $list;
    }

}